package com.qyl.deguru.controller.customer;

import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.qyl.deguru.common.PageConstant;
import com.qyl.deguru.dto.Shop;
import com.qyl.deguru.service.ShopService;
import com.qyl.deguru.service.impl.ShopServiceImple;

/**
 * 取消订单的原因
 * */
@Controller
@RequestMapping("/customer/reason")
public class ReasonController {
	ShopService shopService=new ShopServiceImple();
	@RequestMapping("/toreason")
	public String toReason(int rid,ModelMap modelMap){
		Shop shops=shopService.getShopById(rid);
		modelMap.addAttribute("shops", shops);
		return "comfirm_order_reason";
	}
	@RequestMapping("/toSelect")
	public String toSelect(int lid,HttpSession session,ModelMap modelMap){
		Map<Integer, Integer> shopClean=(Map<Integer, Integer>) session.getAttribute(PageConstant.SHOP_CAR);
		//根据key清除对应的值
		shopClean.remove(lid);
		modelMap.put(PageConstant.TIP, "取消订单成功");
		return "shop_cart";
	}
}
